home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / windows / wdj1096.zip / OTALA.ZIP / TASKHELP.CPP < prev   
C/C++ Source or Header  |  1996-07-03  |  515b  |  27 lines

  1. #include <windows.h>
  2. #include <toolhelp.h>
  3.  
  4. HMODULE ModuleFromTask(HTASK hTask)
  5. {
  6.     TASKENTRY te;
  7.     te.dwSize = sizeof(te);
  8.     if (TaskFindHandle(&te, hTask))
  9.         return (te.hModule);
  10.     return (NULL);
  11. }
  12.  
  13. HTASK TaskFromInstance(HINSTANCE hInstance)
  14. {
  15.     TASKENTRY te;
  16.     te.dwSize = sizeof(te);
  17.     BOOL fLoop = TaskFirst(&te);
  18.     while (fLoop)
  19.     {
  20.         if (te.hInst == hInstance)
  21.             return (te.hTask);
  22.         fLoop = TaskNext(&te);
  23.     }
  24.     return (NULL);
  25. }
  26.  
  27.